package cn.pugle.quartz.cluster.annotation;


import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * copy from {@link  org.springframework.scheduling.annotation.Scheduled} <br>
 * process by {@link QuartzScheduledAnnotationBeanPostProcessor} <br>
 * identify a method should be register to a quartz scheduler <br>
 * Created by tzp on 16/11/28.
 */
@Target({ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface QuartzScheduled {
    /**
     * A cron-like expression, extending the usual UN*X definition to include
     * triggers on the second as well as minute, hour, day of month, month
     * and day of week.  e.g. {@code "0 * * * * MON-FRI"} means once per minute on
     * weekdays (at the top of the minute - the 0th second).
     *
     * @return an expression that can be parsed to a cron schedule
     */
    String cron() default "";

    /**
     * A time zone for which the cron expression will be resolved. By default, this
     * attribute is the empty String (i.e. the server's local time zone will be used).
     *
     * @return a zone id accepted by {@link java.util.TimeZone#getTimeZone(String)}, or an empty
     * String to indicate the server's default time zone
     * @see org.springframework.scheduling.support.CronTrigger#CronTrigger(String,
     * java.util.TimeZone)
     * @see java.util.TimeZone
     */
    String zone() default "";

    /**
     * Execute the annotated myMethod with a fixed period between invocations.
     *
     * @return the period in milliseconds
     */
    int interval() default -1;


    /**
     * Number of milliseconds to delay before the first execution of a
     * {@link #interval()} task.
     *
     * @return the initial delay in milliseconds
     */
    int initialDelay() default -1;

}
